<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/13
 * Time: 19:43
 */
if ($_SERVER["REQUEST_METHOD"]!="POST"){
    $result=array("msg"=>"对不起,不支持get请求","status"=>-1);
    print_r(json_encode($result));
    return;
}
//post请求
if(!(isset($_POST["useName"])&&$_POST["usePwd"])){
    $result=array("msg"=>"参数不完整","status"=>-2);
    print_r(json_encode($result));
    return;
}
include "DBhelper.php"; //引入dbphp

//准备sql语句
$useName=$_POST["useName"];
$useEmaill=$_POST["useEmaill"];
$usePwd=$_POST["usePwd"];
$useTelphone=$_POST["useTelphone"];

$sql="INSERT INTO `use` (`useName`,`useEmaill`,`usePwd`,`useTelphone`) VALUES ('".$useName."','".$useEmaill."','".$usePwd."','".$useTelphone."')";

$resultData=sqlQuery($sql);
 //什么情况下是状态(==1) 插入,删除,修改
  //只有查询是返回一个对象(->num_rows>=1)
if($resultData==1){
    $result=array("msg"=>"注册成功","status"=>1);
    print_r(json_encode($result));
}else{
    $result=array("msg"=>"注册失败","status"=>-3);
    print_r(json_encode($result));
}